package com.iknow.xmpp.service;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import java.util.Date;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.packet.DelayInformation;

public class Message
  implements Parcelable
{
  public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator()
  {
    public Message createFromParcel()
    {
      return new Message(paramParcel, null);
    }

    public Message[] newArray()
    {
      return new Message[paramInt];
    }
  };
  public static final int MSG_IKNOW_AUDIO = 18;
  public static final int MSG_IKNOW_IMAGE = 17;
  public static final int MSG_IKNOW_TEXT = 16;
  public static final int MSG_STATUS_ARRIVE = 3;
  public static final int MSG_STATUS_ARRIVE_READED = 5;
  public static final int MSG_STATUS_READ = 6;
  public static final int MSG_STATUS_SENT = 1;
  public static final int MSG_STATUS_UNREAD = 7;
  public static final int MSG_STATUS_UNSENT = 2;
  public static final int MSG_TYPE_CHAT = 200;
  public static final int MSG_TYPE_ERROR = 400;
  public static final int MSG_TYPE_GROUP_CHAT = 300;
  public static final int MSG_TYPE_NORMAL = 100;
  private String mBody;
  private String mFrom;
  private int mStatus;
  private String mSubject;
  private String mThread;
  private Date mTimestamp;
  private String mTo;
  private int mType;
  private int miKnowType;

  private Message(Parcel paramParcel)
  {
    this.mType = paramParcel.readInt();
    this.miKnowType = paramParcel.readInt();
    this.mStatus = paramParcel.readInt();
    this.mTo = paramParcel.readString();
    this.mBody = paramParcel.readString();
    this.mSubject = paramParcel.readString();
    this.mThread = paramParcel.readString();
    this.mFrom = paramParcel.readString();
    this.mTimestamp = new Date(paramParcel.readLong());
  }

  public Message(String paramString)
  {
    this(paramString, 200);
  }

  public Message(String paramString, int paramInt)
  {
    this.mTo = paramString;
    this.mType = paramInt;
    this.mBody = "";
    this.mSubject = "";
    this.mThread = "";
    this.mFrom = null;
    this.mTimestamp = new Date();
  }

  public Message(org.jivesoftware.smack.packet.Message paramMessage)
  {
    this(paramMessage.getTo());
    switch ($SWITCH_TABLE$org$jivesoftware$smack$packet$Message$Type()[paramMessage.getType().ordinal()])
    {
    case 4:
    default:
      this.mType = 100;
      this.mFrom = paramMessage.getFrom();
      if (this.mType != 400)
        break label176;
      localXMPPError = paramMessage.getError();
      String str = localXMPPError.getMessage();
      if (str == null)
        break label165;
      this.mBody = str;
      PacketExtension localPacketExtension = paramMessage.getExtension("delay", "urn:xmpp:delay");
      if (!(localPacketExtension instanceof DelayInformation))
        break label203;
      this.mTimestamp = ((DelayInformation)localPacketExtension).getStamp();
    case 2:
    case 3:
    case 1:
    case 5:
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  return;
                  this.mType = 200;
                }
                this.mType = 300;
              }
              this.mType = 100;
            }
            this.mType = 400;
          }
          label165: this.mBody = localXMPPError.getCondition();
        }
        label176: this.mBody = paramMessage.getBody();
        this.mSubject = paramMessage.getSubject();
        this.mThread = paramMessage.getThread();
      }
      label203: this.mTimestamp = new Date();
    }
  }

  public int describeContents()
  {
    return 0;
  }

  public String getBody()
  {
    return this.mBody;
  }

  public String getFrom()
  {
    return this.mFrom;
  }

  public int getStatus()
  {
    return this.mStatus;
  }

  public String getSubject()
  {
    return this.mSubject;
  }

  public String getThread()
  {
    return this.mThread;
  }

  public Date getTimestamp()
  {
    return this.mTimestamp;
  }

  public String getTo()
  {
    return this.mTo;
  }

  public int getType()
  {
    return this.mType;
  }

  public int getiKnowType()
  {
    return this.miKnowType;
  }

  public void setBody(String paramString)
  {
    this.mBody = paramString;
  }

  public void setFrom(String paramString)
  {
    this.mFrom = paramString;
  }

  public void setMessageStatus(int paramInt)
  {
    this.mStatus = paramInt;
  }

  public void setStatus(int paramInt)
  {
    this.mStatus = paramInt;
  }

  public void setSubject(String paramString)
  {
    this.mSubject = paramString;
  }

  public void setThread(String paramString)
  {
    this.mThread = paramString;
  }

  public void setTimestamp(Date paramDate)
  {
    this.mTimestamp = paramDate;
  }

  public void setTo(String paramString)
  {
    this.mTo = paramString;
  }

  public void setType(int paramInt)
  {
    this.mType = paramInt;
  }

  public void setiKnowMsgType(int paramInt)
  {
    this.miKnowType = paramInt;
  }

  public void writeToParcel(Parcel paramParcel, int paramInt)
  {
    paramParcel.writeInt(this.mType);
    paramParcel.writeInt(this.miKnowType);
    paramParcel.writeInt(this.mStatus);
    paramParcel.writeString(this.mTo);
    paramParcel.writeString(this.mBody);
    paramParcel.writeString(this.mSubject);
    paramParcel.writeString(this.mThread);
    paramParcel.writeString(this.mFrom);
    paramParcel.writeLong(this.mTimestamp.getTime());
  }
}